package com.cy.demo523.untitled2.src.com.cy.view;

import com.cy.demo523.untitled2.src.com.cy.entity.Student;
import com.cy.demo523.untitled2.src.com.cy.lmpl.StudentService;

import java.sql.SQLException;
import java.util.Scanner;

public class viewMain {
    private static  StudentService service;
    public void ViewMain() {
    }
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        service = new  StudentService ();
        boolean flag = true;
        Scanner scanner = new Scanner(System.in);

        while (flag) {
            System.out.println("欢迎来到校园商品售卖管理系统");
            System.out.println("请选择你的操作");
            System.out.println("1. 用户登录");
            System.out.println("2. 用户注册");
            System.out.println("3. 退出商品");

            int i = scanner.nextInt();

            switch (i) {
                case 1:
                    System.out.println("用户登录");
                    break;
                case 2:
                    Student student = new Student();
                    System.out.println("请输入用户名");
                    student.setStudentName(scanner.next());
                    System.out.println("请输入密码");
                    student.setStudentPassword(scanner.next());
                    System.out.println("请输入手机号");
                    student.setStudentPhone(scanner.next());

                    service.add(student);
                    System.out.println("注册成功！");
                    break;
                case 3:
                    flag = false;
                    break;
                default:
                    System.out.println("输入有误，请重新选择");
            }
        }

        scanner.close();
    }
}
